package com.demo.supplier.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 操作日志实体类（MongoDB）
 * 
 * @author demo
 */
@Data
@Document(collection = "operation_logs")
@ApiModel("操作日志实体")
public class OperationLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @ApiModelProperty("日志ID")
    private String id;

    @ApiModelProperty("用户ID")
    private Long userId;

    @ApiModelProperty("用户名")
    private String username;

    @ApiModelProperty("操作类型")
    private String operation;

    @ApiModelProperty("模块名称")
    private String module;

    @ApiModelProperty("操作描述")
    private String description;

    @ApiModelProperty("IP地址")
    private String ip;

    @ApiModelProperty("用户代理")
    private String userAgent;

    @ApiModelProperty("请求数据")
    private String requestData;

    @ApiModelProperty("响应数据")
    private String responseData;

    @ApiModelProperty("执行时间（毫秒）")
    private Long executionTime;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}